<template>
    <div class="add-members">
        <Nav>
            <div slot="left" @click="goBack"> &lt; </div>
            <div slot="center">解决方案-添加成员</div>
            <div slot="right" >···</div>
        </Nav>
        <div class="addphoto">
            <div class="addphoto-center"><img src="@/assets/images/base-images/解决-加.png" alt=""></div>
        </div>
        <add-members-main ref="addmembers" :memberList="memberList"></add-members-main>
        <div class="save">
                <div class="btn" @click="addMembersAndStart">保存并开始评估</div>
            </div>
    </div>
</template>

<script>
import Nav from '@/components/common/Nav.vue';
import {request} from '@/network/request.js';
import AddMembersMain from './AddMembersMain';

    export default {
        data() {
            return {
                memberList: {}
            }
        },
        components: {
            Nav,
            AddMembersMain
        },
        mounted () {

        },
        methods: {
            goBack() {
                this.$router.push('/solve');  
            },
            async addMembersAndStart(){
                if(this.$refs.addmembers.memberList != {} && this.$refs.addmembers.memberList != null){
                        this.memberList = this.$refs.addmembers.memberList;
                    try {
                    const res = request({
                        'data':this.memberList
                    }) 
                    this.memberList = {}
                    this.$router.push({
                        path:'/assessment'
                    })
                } catch (error) {
                    console.log(error);
                }
                }
            }
        },
    }
</script>

<style  scoped>
.addphoto{
    margin-top: 64px;
    width: 100%;
    height: 97px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.addphoto-center{
   width: 76px;
   height: 76px;
   border: 1px dashed #dcdce4;
   border-radius:50%;
   text-align: center;
   line-height: 76px;
   margin-bottom: 2px;
}
.addphoto-center img{
    width: 20px;
    height: 20px;
    vertical-align: middle;
}
.btn{
    font-size: 16px;
    height: 50px;
    width: 325px;
    margin: 20px auto auto auto;
    color: #fff;
    text-align: center;
    line-height: 50px;
    border-radius: 25px;
    background: linear-gradient(to right, #1fcbcf 0%,#0484c3 100%);

}
</style>